package composite;

import java.util.Iterator;

/**
 * @Author: linKe
 * @Date: 2022/1/15 9:35
 * @FileName: MenuItem
 * @version: 1.0
 * @Description: 菜单项
 */
public class MenuItem extends MenuComponent{
    private String name;
    private String description;
    private double price;


    public MenuItem(String name, String description, double price) {
        this.name = name;
        this.description = description;
        this.price = price;
    }

    @Override
    public String getName() {
        return name;
    }

    @Override
    public String getDecrition() {
        return description;
    }

    @Override
    public double getPrice() {
        return price;
    }

    @Override
    public void print() {
        System.out.println("name:" + name + "\n"
                + "description:" + description + "\n"
                + "price:" + price);
    }

    @Override
    public Iterator<MenuComponent> iterator() {
        return new NullIterator();
    }
}
